﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SFML.Graphics;
using SFML.Window;
using Theta.Entities;

namespace Theta.Components
{
    //BaseComponent should NOT be instanced, as it does nothing.
    public abstract class BaseComponent
    {
        protected Entity _parent;

        public Entity Parent
        {
            get { return _parent; }
            set
            {
                if(_parent == null && value != null)
                    OnAdd(value);
                if(_parent != null && value == null)
                    OnRemove();
                _parent = value;
            }
        }

        protected virtual void OnAdd(Entity parent)
        {
        }

        protected virtual void OnRemove()
        {
        }

        public virtual void Update(TimeSpan elapsedTime)
        {
        }

        public virtual void Draw(RenderWindow renderWindow)
        {
        }
    }
}
